import React, { useState, useEffect } from 'react';
import { Form, DatePicker, Select, Modal, Button } from 'antd';
import { connect } from 'umi';
import styles from './index.less';
const { RangePicker } = DatePicker;

var UserAdd = props => {
  const [form] = Form.useForm();
  useEffect(() => {
    if (props.init) props.init(form);
    // getDetailById();
  }, []);

  //更新状态
  const changeState = obj => {
    props.dispatch({
      type: 'SensitivityAnalysis/setState',
      payload: obj,
    });
  };
  //获取所有电厂
  // const getPowerFactoryList = async () => {

  //   var rs = await powerLists();
  //   // 成功
  //   if (rs.code == 200) {

  //   }
  // };

  // const {  } = props.SensitivityAnalysis;

  return (
    <div>
      <Form form={form} layout="vertical">
        <Form.Item name="factory" label="">
          <Select
            style={{ width: '100%' }}
            placeholder="选择电厂"
            showSearch
            filterOption={(inputValue, option) => {
              return option.searchtext?.indexOf(inputValue) > -1;
            }}
          >
            {/* <Select.Option key={'all'} value={''} searchtext="全部">
            全部
          </Select.Option> */}
            {/* {powerFactoryList?.map((item) => {
            return (
              <Select.Option
                key={item.powerCode}
                value={item.powerCode}
                searchtext={item.powerName}
              >
                {item.powerName}
              </Select.Option>
            );
          })} */}
            <Select.Option key={1} value={1} searchtext={1}>
              {1}
            </Select.Option>
          </Select>
        </Form.Item>

        <Form.Item name="date" label="">
          <RangePicker style={{ width: '100%' }} />
        </Form.Item>
      </Form>
    </div>
  );
};

export default connect(({ SensitivityAnalysis }) => ({ SensitivityAnalysis }))(
  UserAdd,
);
